const electron = require('electron')
const {BrowserWindow} = require('electron');
module.exports = {
    //登录窗口
    loginWindow() {
        mainWindow = new BrowserWindow({
            width: 430,
            height: 225,
            useContentSize: true,
            frame: false,
            resizable: false,
            transparent: true,
            webPreferences: {
              nodeIntegration: true,
              webSecurity: false,
               webviewTag: true
            }
        })
        mainWindow.loadFile('app/pages/login.html');
        return mainWindow;
      },
      mainWindow() {
      
        let option = {
          width: 1200,
          height: 650,
          minWidth: 1200,
          minHeight: 250,
          useContentSize: true,
          frame: false,
          resizable: true,
          transparent: true,
          webPreferences: {
            nodeIntegration: true,
            webSecurity: false,
            webviewTag: true
          }
      };

      var FFI = require('ffi');
      var user32 = new FFI.Library('user32', {
        'RegisterWindowMessageA': ['int', ['string']]
      });
      
      var openTdx = user32.RegisterWindowMessageA('Stock');
      
     if(openTdx){
       var workArea=electron.screen.getPrimaryDisplay().workAreaSize;
       //mainWindow.setBounds({x: 0, y: 0, width: workArea.width, height: workArea.height*0.4 })
       option.x = 0;
       option.y = workArea.height*0.6;
       option.width= workArea.width;
       option.height= workArea.height*0.4;
     }

         mainWindow = new BrowserWindow(option)


         mainWindow.loadFile('app/pages/index.html');
         //mainWindow.webContents.openDevTools();
        
         return mainWindow;
       }
      
}